import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


public class EmployeeManager {
	private static EmployeeManager instance = null;
	public static EmployeeManager getInstance() throws SQLException {
		if (instance == null) {
			instance = new EmployeeManager();
			return instance;
		} else {
			return instance;
		}
	}
	protected EmployeeManager() throws SQLException {
		conn = Database.getAccessDBConnection();
	}
	Connection conn = null;
	
	public Employee getEmployee(int employeeId) {
		try {
			Statement stmt = conn.createStatement();
			stmt.execute("SELECT * FROM Employees" + " WHERE employee_id=" + employeeId);
			ResultSet rs = stmt.getResultSet();
			if (!rs.next()) {
				stmt.close();
				return null;
			} else {
				Employee e = new Employee(rs);
				stmt.close();
				return e;
			}
		} catch (SQLException e) {
			return null;
		}
	}
}
